<!--#
layout("/layouts/platform.html"){
#-->
<style>
    .el-msg-active {
        background-color: #546478;
        color: #ffffff;
    }
    input[type=file]{
        display: none;
    }
    .note {
        width: 100%;
        height: 320px;
    }
</style>
<link href="${base!}/assets/platform/plugins/umeditor/themes/default/css/umeditor.min.css" type="text/css"
      rel="stylesheet">
<script src="${base!}/assets/platform/plugins/umeditor/umeditor.config.js"></script>
<script src="${base!}/assets/platform/plugins/umeditor/umeditor.js"></script>
<div id="app" v-cloak>
    <el-row class="header navbar shadow">
        <div class="btn-group tool-button mt5">
            <a href="${base}/platform/sys/msg" data-pjax class="el-button el-button--default el-button--medium"
               :class="{'el-msg-active':'all'==pageForm.searchType}" >
                全部类型信息
            </a>
        </div>
        <div class="btn-group tool-button mt5">
            <a href="${base}/platform/sys/msg/list/system" data-pjax
               class="el-button el-button--default el-button--medium"
               :class="{'el-msg-active':'system'==pageForm.searchType}">
                公共消息
            </a>
        </div>
        <div class="btn-group tool-button mt5">
            <a href="${base}/platform/sys/msg/list/user" data-pjax
               class="el-button el-button--default el-button--medium"
               :class="{'el-msg-active':'user'==pageForm.searchType}">
                私人消息
            </a>
        </div>
        <div class="btn-group tool-button mt5">
            <el-input placeholder="标题" v-trim v-model="pageForm.title" auto-complete="off" tabindex="2" type="text" size="medium"></el-input>
        </div>
        <div class="btn-group tool-button mt5">
            <el-button slot="append" icon="el-icon-search" size="mini" @click="doSearch" circle></el-button>
        </div>
        <div class="pull-right offscreen-right mt5">
            <el-button size="medium" @click="openAdd"><i class="ti-plus"></i> 发送信息</el-button>
        </div>
    </el-row>
    <el-row class="el-table-container">
        <el-table
                :data="tableData"
                @sort-change='pageOrder'
                size="small"
                header-align="center"
                style="width: 100%"
                :default-sort="{prop: 'opAt', order: 'descending'}"
        >
            <el-table-column type="expand">
                <template slot-scope="scope">
                    <el-form label-position="left" inline class="el-table-expand-line" size="mini">
                        <el-form-item label="标题">
                            <span>{{ scope.row.title }}</span>
                        </el-form-item>
                        <el-form-item label="链接">
                            <span>{{ scope.row.url }}</span>
                        </el-form-item>
                        <el-form-item label="内容" :show-overflow-tooltip="true">
                            <span v-html="scope.row.note"></span>
                        </el-form-item>
                    </el-form>
                </template>
            </el-table-column>
            <el-table-column
                    sortable
                    prop="type"
                    label="发送类型"
                    header-align="center" align="center">
                <template slot-scope="scope">
                    <span v-if="'system'==scope.row.type">公共消息</span>
                    <span v-if="'user'==scope.row.type">私人消息</span>
                </template>
            </el-table-column>
            <el-table-column
                    sortable
                    prop="msgType"
                    label="通知类型"
                    header-align="center" align="center">
                <template slot-scope="scope">
                    <span v-if="'0'==scope.row.msgType">通知公告</span>
                    <span v-if="'1'==scope.row.msgType">规章制度</span>
                    <span v-if="'2'==scope.row.msgType">设备资料</span>
                    <span v-if="'3'==scope.row.msgType">知识资料</span>
                </template>
            </el-table-column>
            <el-table-column
                    prop="title"
                    label="标题"
                    header-align="center"
                    :show-overflow-tooltip="true">
            </el-table-column>
            <el-table-column
                    prop="all_num"
                    label="总接收用户"
                    header-align="center" align="center">
                <template slot-scope="scope">
                    <el-button size="small" @click="viewUserList('all',scope.row.id)">{{scope.row.all_num}}</el-button>
                </template>
            </el-table-column>
            <el-table-column
                    prop="unread_num"
                    label="未读用户"
                    header-align="center" align="center">
                <template slot-scope="scope">
                    <el-button size="small" @click="viewUserList('unread',scope.row.id)">{{scope.row.unread_num}}
                    </el-button>
                </template>
            </el-table-column>
            <el-table-column
                    sortable
                    prop="opAt"
                    label="创建时间"
                    header-align="center">
                <template slot-scope="scope">
                    {{formatAt(scope.row.opAt)}}
                </template>
            </el-table-column>
            <el-table-column
                    sortable
                    prop="sendAt"
                    label="发送时间"
                    header-align="center">
                <template slot-scope="scope">
                    {{formatAt(scope.row.sendAt)}}
                </template>
            </el-table-column>
            <el-table-column
                    sortable
                    prop="status"
                    label="信息状态"
                    header-align="center" align="center">
                <template slot-scope="scope">
                    <el-alert
                            v-if="scope.row.status == 0"
                            title="已保存"
                            :closable="false"
                            :center="true"
                            type="info" size="small">
                    </el-alert>
                    <el-alert
                            v-if="scope.row.status==1"
                            title="已发送"
                            :closable="false"
                            :center="true"
                            type="success" size="small">
                    </el-alert>
                </template>
            </el-table-column>
            <el-table-column
                    label="操作"
                    width="120">
                <template slot-scope="scope">
                    <el-dropdown @command="dropdownCommand"  v-if="scope.row.status == 0">
                        <el-button size="mini">
                            <i class="ti-settings"></i>
                            <span class="ti-angle-down"></span>
                        </el-button>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item :command="{type:'msgDo',id:scope.row.id,name:scope.row.title}">
                                发送
                            </el-dropdown-item>
                            <el-dropdown-item :command="{type:'editDo',id:scope.row.id,name:scope.row.title}">
                                修改
                            </el-dropdown-item>
                            <el-dropdown-item :command="{type:'delete',id:scope.row.id,name:scope.row.title}">
                                删除
                            </el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </template>
            </el-table-column>
        </el-table>
    </el-row>

    <el-row class="el-pagination-container">
        <el-pagination
                @size-change="pageSizeChange"
                @current-change="pageNumberChange"
                :current-page="pageForm.pageNumber"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="pageForm.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="pageForm.totalCount">
        </el-pagination>
    </el-row>

    <el-dialog :close-on-click-modal="false"
            :title="viewUserTitle"
            :visible.sync="viewDialogVisible"
            width="65%">
        <el-table
                :data="viewTableData"
                @sort-change='viewPageOrder'
                header-align="center"
                style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
                :default-sort="{prop: 'opAt', order: 'descending'}"
                size="small"
        >
            <el-table-column
                    fixed
                    prop="loginname"
                    label="用户名"
                    width="150">
            </el-table-column>
            <el-table-column
                    prop="username"
                    label="姓名"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="mobile"
                    label="手机">
            </el-table-column>
            <el-table-column
                    prop="email"
                    label="邮箱">
            </el-table-column>
            <el-table-column
                    prop="unitname"
                    label="所属单位">
            </el-table-column>
        </el-table>
        <el-pagination
                @size-change="viewPageSizeChange"
                @current-change="viewPageNumberChange"
                :current-page="viewPageForm.pageNumber"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="viewPageForm.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="viewPageForm.totalCount">
        </el-pagination>
        <span slot="footer" class="dialog-footer">
            <el-button @click="viewDialogVisible = false"> 关 闭 </el-button>
        </span>
    </el-dialog>

    <el-dialog :close-on-click-modal="false"
            title="选择用户"
            :visible.sync="selectDialogVisible"
            width="65%">
        <div class="btn-group tool-button mt5">
            <el-input placeholder="请输入内容" v-trim v-model="selectPageForm.searchKeyword" >
                <el-select v-trim v-model="selectPageForm.searchName" slot="prepend" placeholder="查询类型" style="width: 120px;">
                    <el-option label="用户名" value="loginname"></el-option>
                    <el-option label="姓名" value="username"></el-option>
                    <el-option label="手机" value="mobile"></el-option>
                    <el-option label="邮箱" value="email"></el-option>
                </el-select>
                <el-button slot="append" icon="el-icon-search" @click="doSelectSearch"></el-button>
            </el-input>
        </div>
        <el-table
                :data="selectTableData"
                @sort-change='selectPageOrder'
                header-align="center"
                style="width: 100%;margin-top: 10px;margin-bottom: 10px;"
                :default-sort="{prop: 'opAt', order: 'descending'}"
                @selection-change="handleSelectionChange"
                size="mini"
        >
            <el-table-column
                    type="selection"
                    width="35">
            </el-table-column>
            <el-table-column
                    fixed
                    prop="loginname"
                    label="用户名"
                    width="150">
            </el-table-column>
            <el-table-column
                    prop="username"
                    label="姓名"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="mobile"
                    label="手机"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="email"
                    label="邮箱"
                    width="120">
            </el-table-column>
            <el-table-column
                    prop="unit"
                    label="所属单位">
                <template slot-scope="scope">
                    <span v-if="scope.row.unit!=null">
                        {{scope.row.unit.name}}
                    </span>
                </template>
            </el-table-column>
        </el-table>
        <el-pagination
                @size-change="selectPageSizeChange"
                @current-change="selectPageNumberChange"
                :current-page="selectPageForm.pageNumber"
                :page-sizes="[10, 20, 30, 50]"
                :page-size="selectPageForm.pageSize"
                layout="total, sizes, prev, pager, next, jumper"
                :total="selectPageForm.totalCount">
        </el-pagination>
        <span slot="footer" class="dialog-footer">
            <el-button @click="selectDialogVisible = false"> 取 消 </el-button>
            <el-button type="primary" @click="doSelect"> 确 定 </el-button>
        </span>
    </el-dialog>

    <el-dialog :close-on-click-modal="false"
            title="发送信息"
            :visible.sync="addDialogVisible"
            width="60%">
        <el-form :model="formData" ref="addForm" :rules="formRules" size="small" label-width="80px">
            <el-form-item prop="title" label="标题">
                <el-input maxlength="255" placeholder="标题"
                          v-trim v-model="formData.title"
                          auto-complete="off" tabindex="1" type="text"></el-input>
            </el-form-item>
            <el-form-item prop="url" label="链接地址">
                <el-input placeholder="链接地址"
                          v-trim v-model="formData.url"
                          auto-complete="off" tabindex="2" type="text"></el-input>
            </el-form-item>
            <el-form-item prop="msgType" label="信息类型">
                <el-radio-group v-model="formData.msgType">
                    <el-radio label="0">通知公告</el-radio>
                    <el-radio label="1">规章制度</el-radio>
                    <el-radio label="2">设备资料</el-radio>
                    <el-radio label="3">知识资料</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item prop="type" label="发送类型">
                <el-radio-group v-model="formData.type">
                    <el-radio label="system">公共消息</el-radio>
                    <el-radio label="user">私人消息</el-radio>
                </el-radio-group>
            </el-form-item>
            <el-form-item label="用户列表" v-if="'user'==formData.type">
                <el-row>
                    <el-button icon="el-icon-search" @click="openSelect">选择用户</el-button>
                    <el-button icon="el-icon-delete" @click="clearSelect" type="danger">清空用户</el-button>

                </el-row>
                <el-table
                        :data="userTableData"
                        style="width: 100%"
                        size="small"
                        height="200">
                    <el-table-column
                            fixed
                            prop="loginname"
                            label="用户名"
                            width="100">
                    </el-table-column>
                    <el-table-column
                            prop="username"
                            label="姓名"
                            width="80">
                    </el-table-column>
                    <el-table-column
                            prop="mobile"
                            label="手机号"
                            width="100">
                    </el-table-column>
                    <el-table-column
                            prop="unit"
                            label="所属单位">
                        <template slot-scope="scope">
                            <span v-if="scope.row.unit!=null">
                                {{scope.row.unit.name}}
                            </span>
                        </template>
                    </el-table-column>
                    <el-table-column
                            label="操作" width="70">
                        <template slot-scope="scope">
                            <el-button size="mini" @click="delUser(scope.$index)">移除</el-button>
                        </template>
                    </el-table-column>
                </el-table>
            </el-form-item>
            <el-form-item prop="note" label="信息内容">
                <!---->
                <script type="text/plain" id="note" class="note"></script>
                <!---->
            </el-form-item>
            <el-form-item prop="filePath" label="相关附件">
                <el-upload
                        class="upload-demo"
                        name="Filedata"
                        action="${base}/open/file/upload/file1"
                        :on-remove="handleRemove"
                        :before-upload="beforeUpload"
                        :before-remove="beforeRemove"
                        :on-success="handleSuccess"
                        multiple
                        :limit="3"
                        :on-exceed="handleExceed"
                        :file-list="fileList">
                    <el-button size="small" type="primary">点击上传</el-button>
                </el-upload>
            </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
                <el-button @click="addDialogVisible = false"> 取 消 </el-button>
                <el-button type="primary" @click="doAdd(0)"> 保 存 </el-button>
                <el-button type="primary" @click="doAdd(1)"> 发 送 </el-button>
        </span>
    </el-dialog>
</div>
<script>
    var wo_shi_zhan_wei_fu;
    new Vue({
        el: "#app",
        data: function () {
            return {
                addDialogVisible: false,
                editDialogVisible: false,
                selectDialogVisible: false,
                viewDialogVisible: false,
                tableData: [],
                pageForm: {
                    searchType: "${type!}",
                    title: "",
                    pageNumber: 1,
                    pageSize: 10,
                    totalCount: 0,
                    pageOrderName: "opAt",
                    pageOrderBy: "desc",
                    status:""
                },
                formData: {
                    id: "",
                    type: "system",
                    msgType:"0"
                },
                formRules: {
                    title: [
                        {required: true, message: '标题', trigger: ['blur', 'change']}
                    ],
                },
                selectPageForm: {
                    searchName: "",
                    searchKeyword: "",
                    pageNumber: 1,
                    pageSize: 10,
                    totalCount: 0,
                    pageOrderName: "loginname",
                    pageOrderBy: "ascending"
                },
                selectTableData: [
                    {loginname: 'xxx', realname: "xx", unitname: "ccccccc"}
                ],
                userTableData: [],
                selectUsers: [],
                viewTableData: [],
                viewUserTitle: "",
                viewPageForm: {
                    pageNumber: 1,
                    pageSize: 10,
                    totalCount: 0,
                    pageOrderName: "loginname",
                    pageOrderBy: "descending",
                    type: "",
                    id: ""
                },
                fileList: []

            }
        },
        methods: {
            pageOrder: function (column) {//按字段排序
                this.pageForm.pageOrderName = column.prop;
                this.pageForm.pageOrderBy = column.order;
                this.pageData();
            },
            pageNumberChange: function (val) {//页码更新操作
                this.pageForm.pageNumber = val;
                this.pageData();
            },
            pageSizeChange: function (val) {//分页大小更新操作
                this.pageForm.pageSize = val;
                this.pageData();
            },
            pageData: function () {//加载分页数据
                var self = this;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/platform/sys/msg/data", self.pageForm, function (data) {
                    sublime.closeLoadingbar();//关闭loading
                    if (data.code == 0) {
                        self.tableData = data.data.list;
                        self.pageForm.totalCount = data.data.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            selectPageOrder: function (column) {//按字段排序
                this.selectPageForm.pageOrderName = column.prop;
                this.selectPageForm.pageOrderBy = column.order;
                this.selectPageData();
            },
            selectPageNumberChange: function (val) {//页码更新操作
                this.selectPageForm.pageNumber = val;
                this.selectPageData();
            },
            selectPageSizeChange: function (val) {//分页大小更新操作
                this.selectPageForm.pageSize = val;
                this.selectPageData();
            },
            doSelectSearch: function () {
                this.selectPageForm.pageNumber = 1;
                this.selectPageData();
            },
            selectPageData: function () {//加载分页数据
                var self = this;
                var users = [];
                if (self.userTableData) {
                    self.userTableData.forEach(function (o) {
                        users.push(o.loginname);
                    });
                }
                self.selectPageForm.users = "'"+users.join("','")+"'";
                $.post(base + "/platform/sys/msg/user_data", self.selectPageForm, function (data) {
                    if (data.code == 0) {
                        self.selectTableData = data.data.list;
                        self.selectPageForm.totalCount = data.data.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            handleSelectionChange: function (val) {
                this.selectUsers = val;
            },
            formatAt: function (val) {
                if (val && val > 0)
                    return moment(val * 1000).format("YYYY-MM-DD HH:mm");
                return "";
            },
            doSearch: function (val) {
                this.pageForm.pageNumber = 1;
                this.pageData();
            },
            openSelect: function () {
                this.selectDialogVisible = true;
                this.selectPageData();
            },
            clearSelect: function () {
                this.userTableData = [];
            },
            doSelect: function () {
                var self = this;
                this.selectDialogVisible = false;
                this.selectUsers.forEach(function (o) {
                    self.userTableData.push(o);
                });
            },
            delUser:function(index){
                this.userTableData.splice(index,1)
            },
            openAdd: function () {
                var self = this;
                this.addDialogVisible = true;
                this.formData = {
                    id: "", type: "system",
                    msgType:"0"
                };//打开新增窗口,表单先清空
                if (this.$refs["addForm"])
                    this.$refs["addForm"].resetFields();
                UM.getEditor("note");
                setTimeout(function () {
                    UM.getEditor("note").setContent("",false);
                },200);
                this.fileList= [];
            },
            doAdd: function (status) {
                var self = this;
                self.formData.status = status+"";
                self.$refs["addForm"].validate(function (valid) {
                    if (valid) {
                        var users = [];
                        if (self.userTableData) {
                            self.userTableData.forEach(function (o) {
                                users.push(o.loginname);
                            });
                        }
                        if (self.formData.type == 'user' && users.length == 0) {
                            self.$message({
                                message: "请选择用户",
                                type: 'error'
                            });
                            return false;
                        }
                        $.post(base + "/platform/sys/msg/addDo", {
                            note: UM.getEditor("note").getContent(),
                            msg: JSON.stringify(self.formData),
                            users: users.toString()
                        }, function (data) {
                            if (data.code == 0) {
                                self.$message({
                                    message: data.msg,
                                    type: 'success'
                                });
                                self.addDialogVisible = false;
                            } else {
                                self.$message({
                                    message: data.msg,
                                    type: 'error'
                                });
                            }
                            self.pageData();//添加失败也可以入库,所以加载一下看看
                        }, "json");
                    }
                });
            },
            viewPageOrder: function (column) {//按字段排序
                this.viewPageForm.pageOrderName = column.prop;
                this.viewPageForm.pageOrderBy = column.order;
                this.viewPageLoad();
            },
            viewPageNumberChange: function (val) {//页码更新操作
                this.viewPageForm.pageNumber = val;
                this.viewPageLoad();
            },
            viewPageSizeChange: function (val) {//分页大小更新操作
                this.viewPageForm.pageSize = val;
                this.viewPageLoad();
            },
            viewPageLoad: function () {//加载分页数据
                var self = this;
                $.post(base + "/platform/sys/msg/user_view_data", self.viewPageForm, function (data) {
                    if (data.code == 0) {
                        self.viewTableData = data.data.list;
                        self.viewPageForm.totalCount = data.data.totalCount;
                    } else {
                        self.$message({
                            message: data.msg,
                            type: 'error'
                        });
                    }
                }, "json");
            },
            viewUserList: function (type, id) {
                var self = this;
                if ("all" == type) {
                    self.viewUserTitle = "全部用户";
                }
                if ("unread" == type) {
                    self.viewUserTitle = "未读用户";
                }
                self.viewDialogVisible = true;
                self.viewPageForm.type = type;
                self.viewPageForm.id = id;
                self.viewPageLoad();
            },
            dropdownCommand: function (command) {//监听下拉框事件
                var self = this;
                if ("delete" == command.type) {
                    self.$confirm('此操作将删除 ' + command.name, '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        callback: function (a, b) {
                            if ("confirm" == a) {//确认后再执行
                                $.post(base + "/platform/sys/msg/delete/" + command.id, {}, function (data) {
                                    if (data.code == 0) {
                                        self.$message({
                                            message: data.msg,
                                            type: 'success'
                                        });
                                        self.doSearch();
                                    } else {
                                        self.$message({
                                            message: data.msg,
                                            type: 'error'
                                        });
                                    }
                                }, "json");
                            }
                        }
                    });
                }
                if ("msgDo" == command.type) {
                    self.$confirm('此操作将发送 ' + command.name, '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning',
                        callback: function (a, b) {
                            if ("confirm" == a) {//确认后再执行
                                $.post(base + "/platform/sys/msg/msgDo" , {id:command.id}, function (data) {
                                    if (data.code == 0) {
                                        self.$message({
                                            message: data.msg,
                                            type: 'success'
                                        });
                                        self.doSearch();
                                    } else {
                                        self.$message({
                                            message: data.msg,
                                            type: 'error'
                                        });
                                    }
                                }, "json");
                            }
                        }
                    });
                }
                if ("editDo" == command.type) {
                    self.fileList=[];
                    self.formData={};
                    $.post(base + "/platform/sys/msg/detail/"+command.id, {}, function (data) {
                        if (data.code == 0) {
                            self.formData = data.data;
                            //self.userTableData=data.data.userList;
                            self.addDialogVisible = true;
                            UM.getEditor("note");
                            setTimeout(function () {
                                UM.getEditor("note").setContent(self.formData.note,false);
                            },900);
                            self.setFile(self.formData.fileId);
                            $.post(base + "/platform/sys/msg/detailUser/"+command.id, {}, function (data) {
                                if (data.code == 0) {
                                    self.userTableData=data.data;
                                    //self.selectUsers=data.data;
                                }
                            }, "json");
                        }
                    }, "json");
                }
            },
            handleRemove: function (file, fileList) {
                var self = this;
                var thisData = file.response.data;
                sublime.showLoadingbar();//显示loading
                $.post(base + "/open/file/upload/delFile/"+thisData.id, {}, function (data) {
                    if (data.code == 0) {
                        sublime.closeLoadingbar();//关闭loading
                        self.$message({message: data.msg,type: 'success'});
                        if(self.formData.fileId && self.formData.fileId!=""){
                            if(self.formData.fileId.split(",").length>1){
                                self.formData.fileId = self.formData.fileId.replace(","+thisData.id,"");
                            }else{
                                self.formData.fileId = "";
                            }
                            /*$.post(base + "/platform/sys/msg/editFile" , self.formData, function (res) {
                                if (res.code == 0) {
                                    self.$message({message: res.msg,type: 'success'});
                                } else {
                                    self.$message({message: res.msg,type: 'error'});
                                }
                            }, "json");*/
                        }
                    } else {
                        self.$message({message: data.msg,type: 'error'});
                    }
                }, "json");
            },
            handleExceed: function (files, fileList) {
                this.$message.warning(`当前限制选择 3 个文件，本次选择了 `+files.length+` 个文件，共选择了 `+(files.length + fileList.length)+` 个文件`);
            },
            beforeUpload:function(file){
                const isLt2M = file.size / 1024 / 1024 < 200; // 小于2MB
                if (!isLt2M) {
                    this.$message.error('上传的文件大小不能超过 200MB!');
                }
                return isLt2M;
            },
            beforeRemove: function (file) {
                //return this.$confirm(`确定移除 `+file.name+`？`);
            },
            handleSuccess:function(file){
                if(this.formData.fileId && this.formData.fileId!=""){
                    this.formData.fileId += ","+file.data.id;
                }else{
                    this.formData.fileId = file.data.id;
                }
            },
            setFile: function (fileId) {
                var self = this;
                if(fileId && fileId!=""){
                    var fileIds = fileId.split(",")
                        for(var i=0;i<fileIds.length;i++){
                            $.post(base + "/open/file/upload/getFile/"+fileIds[i], {}, function (data) {
                                if (data.code == 0) {
                                    var file = {
                                        name:data.data.fileBeforeName,
                                        response:{
                                            data:data.data
                                        }
                                    }
                                    self.fileList.push(file);
                                } else {
                                    self.$message({message: data.msg,type: 'error'});
                                }
                            }, "json");
                        }

                }
            },
        },
        created: function () {
            this.doSearch();
        }
    });
</script>

<!--#
}
#-->
